<div class="layui-card-body" style="width: 750px;">

    <div class="layui-tab" lay-filter="tabmain">
        <ul class="layui-tab-title">
            <li class="layui-this" lay-id="11">设置</li>
            <li lay-id="22">订购历史</li>

        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-row">
                    <div class="layui-col-md6">
                        <form class="layui-form" action="{:url()}" method="post">
                            <div class="layui-form-item">
                                <label class="layui-form-label">产品名称</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$info.product_title|default=''}" class="layui-input"
                                           readonly>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">开始时间</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$info.s_time|default=''}" class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">结束时间</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$info.e_time|default=''}" class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">管理员帐号</label>
                                <div class="layui-input-block">
                                    <input type="text"  id="username"
                                           class="layui-input" value="{$info.username|default=''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">管理员密码</label>
                                <div class="layui-input-block">
                                    <input type="text"  placeholder="" id="password"
                                           class="layui-input" value="{$info.password|default=''}">
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <label class="layui-form-label">分配域名</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$info.domain|default=''}"
                                           class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-form-item ">
                                <label class="layui-form-label">自定义域名</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$info.diy_domain|default=''}"
                                           class="layui-input" name="diy_domain">
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">说明</label>
                                <div class="layui-input-block">
                                    <textarea name="info" placeholder="请不要超过50个汉字" class="layui-textarea">{$info.info|default=''}</textarea>
                                </div>
                            </div>

                            <input type="hidden" name="id" value="{$info.id|default=''}">

                    </div>
                    <div class="layui-col-md5 layui-col-md-offset1">
<pre class="layui-code">管理员帐号和密码是初始时的信息
点击重设后会重新生成帐号和密码
重设后在10分钟内会设置完成
自定义域名设置后，系统分配域名会失效
自定义域名建议使用正常备案域名</pre>
                        <button type="button" class="layui-btn layui-btn-danger layui-btn-fluid" lay-submit
                                lay-filter="readmin">重设管理员帐号密码
                        </button>

                    </div>
                </div>
                </form>

            </div>
            <div class="layui-tab-item">
                <table class="layui-table text-center" id="list22" lay-filter="list22"
                       list-url="{:url('/home/order/outorderlists')}"
                ></table>
            </div>

        </div>
    </div>


</div>
<style>
    .layui-anim-upbit {
        text-align: left;
    }
</style>
<script type="text/javascript">
    layui.use(['element', 'form', 'layer', 'table', 'code'], function () {
        var form = layui.form
            , table = layui.table
            , $ = layui.$
            , element = layui.element
            , code = layui.code
            , laydate = layui.laydate;

        form.on('submit(readmin)', function (data) {
            $.ajax({
                url: "{:url('/home/productmain/readmin')}",
                type: 'post',
                dataType: 'json',
                data: {
                    id: '{$info.id}',
                }
            })
                .done(function (res) {
                    if (res.code == 1) {
                        layer.alert(res.msg, {
                            closeBtn: 0
                            , anim: 3 //动画类型
                        });
                        var users = JSON.parse(res.data);
                        $('#username').val(users.username)
                        $('#password').val(users.password)

                    } else if (res.code == 0) {
                        layer.alert(res.msg, {
                            closeBtn: 0
                            , anim: 3 //动画类型
                        });
                    } else {
                        layer.msg('服务器错误', {
                            time: 1500,
                            icon: 5
                        });

                    }
                })
                .fail(function () {
                    layer.msg('服务器异常,请稍后再试', {
                        time: 1500,
                        icon: 5
                    });
                })
                .always(function () {

                });

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        layui.code({
            about: false,

            title: '设置说明'
        });
        element.on('tab(tabmain)', function (data) {
            if (this.getAttribute('lay-id') == 22) {
                table.reload('list22', {
                    url: "{:Url('/home/order/outorderlists?product_run_id='.$info.id)}"
                    , where: {} //设定异步数据接口的额外参数
                    //,height: 300
                });
            }
        });

        table.render({
            elem: '#list22'
            , url: "{:Url('/home/order/outorderlists?product_run_id='.$info.id)}"
            , page: true
            , limit: 20
            , cols: [[
                {field: 'order_id', width: 175, title: '订单号', sort: true}
                , {field: 'c_time', width: 175, title: '下单时间'}
                , {field: 'price', width: 100, title: '支付价格', align: 'right'}
                , {field: 'status', width: 90, title: '订单状态'}
            ]]
        });

    });

</script>






